package cn.bytecollege.controller;

import cn.bytecollege.service.GetEmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.servlet.http.HttpSession;
import java.util.Random;

/**
 * @author 丁金磊
 */
@Controller
public class GetEmailController {

    @Autowired
    GetEmailService getEmailService;
    @RequestMapping("/getEmail")
    public String getEmail(String email, HttpSession session){
        String validCode = getEmailService.getEmail(email);
        session.setAttribute("validCode", validCode);
        return "register::validCode";
    }
}
